﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MvcApplication6.Models;
using MvcApplication6.DAL;

namespace MvcApplication6.BIZ
{
    public class PagingBIZ
    {
        PagingDAL pagingDAL = new PagingDAL();
        public List<ProductModel> ProductSearchSale(int pagendex, int flag, int pageSize)
        { 
            try
            {
                List<ProductModel> lst = new List<ProductModel>();
                lst = pagingDAL.ProductSearchSale(pagendex, flag, pageSize);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public int ProductSearchSaleCount(int flag)
        { 
             try
            {
                int totalRecord = 0;
                totalRecord = pagingDAL.ProductSearchSaleCount(flag);

                return totalRecord ;
            }
            catch (Exception)
            {
                throw;
            }
        
        }


        public List<ProductModel> ProductPagingById(int PageIndex, int Id, int MenuLevel)
        {
            try
            {
                List<ProductModel> lst = new List<ProductModel>();
                lst = pagingDAL.ProductPagingById(PageIndex, Id, MenuLevel);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public int ProductCountPagingById(int Id, int MenuLevel)
        {
            try
            {
                int totalRecord = 0;
                totalRecord = pagingDAL.ProductCountPagingById(Id, MenuLevel);

                return totalRecord;
            }
            catch (Exception)
            {
                throw;
            }

        }

        public List<EventModel> EventPagingById_ce(int PageIndex, int Id)
        {
            try
            {
                List<EventModel> lst = new List<EventModel>();
                lst = pagingDAL.EventPagingById_ce(PageIndex, Id);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public int EventCountPagingById_ce(int Id)
        {
            try
            {
                int totalRecord = 0;
                totalRecord = pagingDAL.EventCountPagingById_ce(Id);

                return totalRecord;
            }
            catch (Exception)
            {
                throw;
            }

        }

        public int spProductCountSearchByName(string name)
        {
            try
            {
                int totalRecord = 0;
                totalRecord = pagingDAL.spProductCountSearchByName(name);

                return totalRecord;
            }
            catch (Exception)
            {
                throw;
            }

        }

        public List<ProductModel> proDuctSearchByNme(string name, int pageIndex)
        {
            try
            {
                List<ProductModel> productModelList = new List<ProductModel>();
                productModelList = pagingDAL.proDuctSearchByNme(name, pageIndex);

                return productModelList;
            }
            catch (Exception)
            {
                throw;
            }

        }



    }
}